package com.bruce.pattern.behavioral.observer;

import com.bruce.pattern.behavioral.observer.guava.GuavaEvent;
import com.google.common.eventbus.EventBus;
import org.junit.Test;

/**
 * Created by bruce on 2018/11/10 20:10
 */
public class MainTest {

    @Test
    public void test1() {
        Myself myself1 = new Myself("so easy--");
        Myself myself2 = new Myself("曾经的约定");

        Friend friend = new Friend("彼岸花开");
        friend.addObserver(myself1);
        friend.addObserver(myself2);

        Weibo weibo = new Weibo("好好学习,天天向上");
        friend.sendWeibo(weibo);
    }

    @Test
    public void test2() {
        EventBus eventBus = new EventBus();
        GuavaEvent guavaEvent = new GuavaEvent();

        eventBus.register(guavaEvent);

        eventBus.post("hello GuavaEvent");
    }


}
